﻿<%@ Page Title=""  Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage(Of IEnumerable(Of Aviso))" %>
<%@ Import Namespace="Telerik.Web.Mvc.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Avisos - ASINDO
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<script type="text/javascript">
	    function gridloaded() {
	        $('.t-grid-filter').click();
	        $('.t-filter-options').hide();
	        //$('.t-filter-options:gt(0)').find('select').hide().end().find('.t-filter-help-text:eq(0)').html('Mostrar filas que contengan');
	    }
	</script>
    <h2><%: ViewData("Titulo")%></h2>

    <p>
        <%:Html.ActionLink("Nuevo aviso", "Crear")%>
    </p>

<% 
            Html.Telerik().Grid(Of Aviso)(Model) _
                            .Name("Grid") _
                            .DataKey(Function(a) a.Id) _
                            .EnableCustomBinding(True) _
                            .DataBinding(Sub(databinding)
                                             databinding.Server().Select("ListaGrid", "Aviso")
                                         End Sub) _
                            .Columns( _
                                    Sub(colfactory)
                                        'colfactory.Command(Sub(commands)
                                        '                       commands.Delete()
                                        '                   End Sub).Width(140)
                                        colfactory.Template(Sub(d)%>
<a href="<%: Url.Action("Editar", New With {.id = d.Id})%>"><img alt="Editar" src="<%: Url.Content("~/Content/fugue/magnifier.png") %>" /> Editar</a>
<%                                                  End Sub).Width(70)
                                        colfactory.Template(Sub(d)%>
<%: d.FechaHora.ToString("dddd")%>
<%                                                  End Sub).Width(70).Title("Día")
                                        colfactory.Bound(Function(a) a.FechaHora).Format("{0:dd/MM/yyyy}").Width(80).Title("Fecha")
                                        colfactory.Template(Sub(d)%>
<%: d.FechaHora.ToString("HH:mm")%>
<%                                                  End Sub).Width(70).Title("Hora")
                                        colfactory.Bound(Function(a) a.Paciente.NombreCompleto).Title("Paciente")
                                        colfactory.Bound(Function(a) a.Dirección.Completa).Title("Dirección")
                                        colfactory.Bound(Function(a) a.PediatraAsindo.NombreCompleto).Title("Pediatra")
                                    End Sub) _
                            .Scrollable() _
                            .ClientEvents(Sub(events)
                                              events.OnLoad("gridloaded")
                                          End Sub) _
                            .Sortable(Function(sorting) sorting _
                                        .SortMode(GridSortMode.SingleColumn) _
                                        .OrderBy(Sub(gg)
                                                     gg.Add(Function(p) p.Fecha).Ascending()
                                                 End Sub) _
                                     ) _
                            .Pageable(Sub(paging) paging.PageSize(25).Total(CInt(ViewData("Total")))) _
                            .Filterable() _
                            .Footer(True) _
                            .Render()
            %>
</asp:Content>
